//
//  WKAddressTableViewCell.m
//  ourToken
//
//  Created by wakeup on 2018/5/31.
//  Copyright © 2018年 ourtoken. All rights reserved.
//

#import "WKAddressTableViewCell.h"
#import "WKBaseHeader.h"

@implementation WKAddressTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.backView.layer.cornerRadius = 10;
    self.backView.layer.masksToBounds = YES;
//    self.updateBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
//    self.deleteBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
//    self.deleteBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 20);
    
//    [self.deleteBtn setTitle:@"啦啦啦啦啦啦啦啦啦" forState:UIControlStateNormal];
//
//    CGFloat width = [WKAppObjectManager sizeWidthWithFont:[UIFont systemFontOfSize:12] maxW:200 withContent:@"啦啦啦啦啦啦啦啦啦"];
//    self.deleteBtn.frame = CGRectMake(self.deleteBtn.frame.origin.x, self.deleteBtn.frame.origin.y, width, self.deleteBtn.frame.size.height);
}

- (void)setAddressListModel:(WKAddressListModel *)addressListModel {
    _addressListModel = addressListModel;
    
    self.name.text = addressListModel.name;
    self.address.text = addressListModel.address;
    self.coinType.text = addressListModel.coinType;
    
    if ([addressListModel.coinType isEqualToString:@"BTC"]) {
        self.coinImageView.image = [UIImage imageNamed:@"b"];
    }
    else if ([addressListModel.coinType isEqualToString:@"ETH"]) {
        self.coinImageView.image = [UIImage imageNamed:@"e"];
    }
}

//修改
- (IBAction)clickUpdateBtn:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(updateAddressWithTableViewCell:andUpdateBtn:)]) {
        [self.delegate updateAddressWithTableViewCell:self andUpdateBtn:sender];
    }
}

//删除
- (IBAction)clickDeleteBtn:(UIButton *)sender {
    if ([self.delegate respondsToSelector:@selector(deleteAddressWithTableViewCell:andDeleteBtn:)]) {
        [self.delegate deleteAddressWithTableViewCell:self andDeleteBtn:sender];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
